package com.joplus.housekeeper.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Pattern;

/**
 * Created by ccm on 2016/8/22 19:04
 * 9:30-22:30是工作时间;
 */
public class WorkTimeUtil {

    public static boolean isWork() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        Date date = new Date(System.currentTimeMillis());
        String time = sdf.format(date);
        Pattern compile = Pattern.compile(":");
        String[] split = compile.split(time);
        String s1 = split[0];
        String s2 = split[1];
        int h = Integer.parseInt(s1);
        int m = Integer.parseInt(s2);

        if (h >= 9 && h < 22) {
            if (h == 9) {
                if (m >= 30) {
                    return true;
                } else {
                    return false;
                }

            }
            return true;
        }
        return false;
    }


    public static boolean isTimeBig12() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
        Date date = new Date(System.currentTimeMillis());
        String time = sdf.format(date);
        Pattern compile = Pattern.compile(":");
        String[] split = compile.split(time);
        String s1 = split[0];
        String s2 = split[1];
        int h = Integer.parseInt(s1);
        int m = Integer.parseInt(s2);

        if (h >= 12 && m >= 30) {

            return true;
        }
        return false;
    }


}
